/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "cex_pueblo")
@NamedQueries({
    @NamedQuery(name = "CexPueblo.findAll", query = "SELECT c FROM CexPueblo c")})
public class CexPueblo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cpu_id")
    private Integer cpuId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "cpu_nombre")
    private String cpuNombre;
    @Column(name = "cpu_codigo")
    private Integer cpuCodigo;
    @OneToMany(mappedBy = "cexPueblo", fetch = FetchType.LAZY)
    private List<CexHistoriaClinica> cexHistoriaClinicaList;

    public CexPueblo() {
    }

    public CexPueblo(Integer cpuId) {
        this.cpuId = cpuId;
    }

    public CexPueblo(Integer cpuId, String cpuNombre) {
        this.cpuId = cpuId;
        this.cpuNombre = cpuNombre;
    }

    public Integer getCpuId() {
        return cpuId;
    }

    public void setCpuId(Integer cpuId) {
        this.cpuId = cpuId;
    }

    public String getCpuNombre() {
        return cpuNombre;
    }

    public void setCpuNombre(String cpuNombre) {
        this.cpuNombre = cpuNombre;
    }

    public Integer getCpuCodigo() {
        return cpuCodigo;
    }

    public void setCpuCodigo(Integer cpuCodigo) {
        this.cpuCodigo = cpuCodigo;
    }

    public List<CexHistoriaClinica> getCexHistoriaClinicaList() {
        return cexHistoriaClinicaList;
    }

    public void setCexHistoriaClinicaList(List<CexHistoriaClinica> cexHistoriaClinicaList) {
        this.cexHistoriaClinicaList = cexHistoriaClinicaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cpuId != null ? cpuId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CexPueblo)) {
            return false;
        }
        CexPueblo other = (CexPueblo) object;
        if ((this.cpuId == null && other.cpuId != null) || (this.cpuId != null && !this.cpuId.equals(other.cpuId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.CexPueblo[ cpuId=" + cpuId + " ]";
    }
    
}
